package com.bjpowernode.springboot.controller;

import com.bjpowernode.springboot.model.Student;
import com.bjpowernode.springboot.service.StudentService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class MyController {

    @DubboReference(interfaceClass = StudentService.class,version = "1.0.0",check = false)
    private StudentService studentService;

    @RequestMapping(value = "/student/detail/{id}")
    public String studentDetail(@PathVariable("id") Integer id, Model model){
        //根据学生id查询详情
        Student student=studentService.queryStudentById(id);
        model.addAttribute("student",student);

        return "studentDetail";
    }
}
